# class Coder(object):
#     def __init__(self, money, title):
#         self.__money = money
#         self.title = title
#
#     def work(self):
#         print('程序员爱工作')
#
#     def sleep(self):
#         print('程序员没有觉睡')
#
#     def __imagine(self):
#         print(f'幻想存款有:{self.__money}')
#
# n = Coder(500, '老板')
# n.work()
# n.sleep()
# n.__money()
# n.__imagine()
#
# class Rookie(Coder):
#     def work(self):
#         # 重写父类方法
#         print('菜鸟不爱工作')
# c = Rookie(1000,'菜鸟')
# c.work()
# #
#
# class God(Coder):
#     def work(self):
#         super().work()
#         # 扩展重写
#         print('好羡慕大神哦')
# a = God(10000,'大神')
# # a.work()
#
# class Bus(object):
#     def __init__(self,type_name,seat_count):
#         # '''自定义属性'''
#         self.type_name = type_name
#         self.seat_count = seat_count
#         self.member_list = []
#     def add_bus(self,people):
#         if self.seat_count != 0:
#             self.member_list.append(people.name)
#             self.seat_count -= 1
#         else:
#             print('没有座位了')
#     def sub_bus(self,people):
#             self.member_list.remove(people.name)
#             self.seat_count += 1
#     def __str__(self):
#         return f'类型:{self.type_name},座位数:{self.seat_count},乘客列表:{self.member_list}'
#
# class Person(object):
#     def __init__(self,name):
#         self.name = name
# b1 = Bus('公交车',20)
# n1 = Person('小明')
# n2 = Person('小红')
# n3 = Person('小丽')
# b1.add_bus(n1)
# b1.add_bus(n2)
# b1.add_bus(n3)
# print(b1)
# b1.sub_bus(n3)
# print(b1)
class Company(object):
    # '''定义公司类'''
    company_name = '黑马程序员'
    def __init__(self,name,age):
        self.name = name
        self.age = age
        # 设置实例属性
    @staticmethod
    def show_company_info():
        print(f'{Company.company_name}')
        # 静态方法,内部用类名.属性名
    @classmethod
    def change_company_name(cls):
        cls.company_name = '传智教育'
        # 类方法内部用cls.属性名/方法名
    def show_info(self):
        print(f'员工姓名{self.name},所属公司{Company.company_name}')
        # 设置实例方法
# 创建对象
n = Company('小明',20)
# 调用实例方法
n.show_info()
# 调用类方法 类名.类方法
Company.change_company_name()
n.change_company_name()
# 调用静态方法,类名.静态方法
# 用对象名.静态方法
Company.show_company_info()
n.show_company_info()